package com.example.demo3.controller;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

public abstract class BaseController {
	protected Logger logger = LoggerFactory.getLogger(this.getClass());
	
	@Resource
	private HttpServletRequest request;
	
	
	@ModelAttribute
	protected void attributes(HttpServletRequest request, ModelMap model) {
		String base = request.getContextPath();
		model.addAttribute("ctx", base);
		model.addAttribute("static", base + "/static");
	}
}
